package cn.com.nwpu.visual_system.utils;

/**
 * @author Hutengzhong
 * @version 1.0.0
 * @title Response
 * @description 响应结果
 * @date 2024/4/26 17:10
 */
public class Response {
    private int status;       // 响应状态: 200成功, 其它失败
    private String errorMsg;  // 失败信息描述
    private String sucessMsg; // 请求成功信息描述

    //  响应数据:1,允许是map对象3,允许是collection对象2,允许对象4,允许是数组
    private Object data;

    public Response(){
    }

    public Response(int status, String msg, Boolean bool){
        if (bool){
            // 成功
            this.status = status;
            this.sucessMsg = msg;
        }else {
            // 失败
            this.status = status;
            this.errorMsg = msg;
        }
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getSucessMsg() {
        return sucessMsg;
    }

    public void setSucessMsg(String sucessMsg) {
        this.sucessMsg = sucessMsg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Response{" +
                "status=" + status +
                ", errorMsg='" + errorMsg + '\'' +
                ", sucessMsg='" + sucessMsg + '\'' +
                '}';
    }
}
